package com.ruoyi.system.service.construction.strategy.impl;

import com.ruoyi.system.domain.construction.strategy.ConstructionStrategy;
import com.ruoyi.system.domain.zhuangxiumain.shopMain.SupplierInfo;
import com.ruoyi.system.mapper.construction.strategy.ConstructionStrategyMapper;
import com.ruoyi.system.mapper.zhuangxiumapper.shopMapper.SupplierInfoMapper;
import com.ruoyi.system.service.construction.strategy.ConstructionStrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 施工攻略Service业务层处理
 *
 * @author zhangshaocong
 * @date 2020-12-03
 */
@Service
public class ConstructionStrategyServiceImpl implements ConstructionStrategyService
{
    @Autowired
    private ConstructionStrategyMapper constructionStrategyMapper;

    @Autowired
    private SupplierInfoMapper supplierInfoMapper;
    /**
     * 查询施工攻略
     *
     * @param constructionStrategyId 施工攻略ID
     * @return 施工攻略
     */
    @Override
    public ConstructionStrategy selectConstructionStrategyById(Long constructionStrategyId)
    {
        return constructionStrategyMapper.selectConstructionStrategyById(constructionStrategyId);
    }

    /**
     * 查询施工攻略列表
     *
     * @param constructionStrategy 施工攻略
     * @return 施工攻略
     */
    @Override
    public List<ConstructionStrategy> selectConstructionStrategyList(ConstructionStrategy constructionStrategy)
    {
        return constructionStrategyMapper.selectConstructionStrategyList(constructionStrategy);
    }

    /**
     * 新增施工攻略
     *
     * @param constructionStrategy 施工攻略
     * @return 结果
     */
    @Override
    public int insertConstructionStrategy(ConstructionStrategy constructionStrategy)
    {
        return constructionStrategyMapper.insertConstructionStrategy(constructionStrategy);
    }

    /**
     * 修改施工攻略
     *
     * @param constructionStrategy 施工攻略
     * @return 结果
     */
    @Override
    public int updateConstructionStrategy(ConstructionStrategy constructionStrategy)
    {
        return constructionStrategyMapper.updateConstructionStrategy(constructionStrategy);
    }

    /**
     * 批量删除施工攻略
     *
     * @param constructionStrategyIds 需要删除的施工攻略ID
     * @return 结果
     */
    @Override
    public int deleteConstructionStrategyByIds(Long[] constructionStrategyIds)
    {
        return constructionStrategyMapper.deleteConstructionStrategyByIds(constructionStrategyIds);
    }

    /**
     * 删除施工攻略信息
     *
     * @param constructionStrategyId 施工攻略ID
     * @return 结果
     */
    @Override
    public int deleteConstructionStrategyById(Long constructionStrategyId)
    {
        return constructionStrategyMapper.deleteConstructionStrategyById(constructionStrategyId);
    }

    /**
     * 查询用户下的店铺列表
     * @param userId
     * @return
     */
    public List<SupplierInfo> selectSupplierList(Long userId){
        SupplierInfo supplierInfo = new SupplierInfo();
        supplierInfo.setCustomerId(userId);
        // 创建集合储存供应商ID
        List<Long> supplierIds = new ArrayList<Long>();
        // 根据用户ID查询供应商信息
        List<SupplierInfo> supplierInfoList = supplierInfoMapper.selectSupplierInfoByUserId(supplierInfo);
        return supplierInfoList;
    }

    @Override
    public List<ConstructionStrategy> findAllSand(ConstructionStrategy constructionStrategy) {
        return constructionStrategyMapper.findAllSand(constructionStrategy);
    }

    @Override
    public List<ConstructionStrategy> findAllZhengWu(ConstructionStrategy constructionStrategy) {
        return constructionStrategyMapper.findAllZhengWu(constructionStrategy);
    }

    @Override
    public List<ConstructionStrategy> findAllShiPin(ConstructionStrategy constructionStrategy) {
        return constructionStrategyMapper.findAllShiPin(constructionStrategy);
    }

    @Override
    public List<ConstructionStrategy> gonglvList(ConstructionStrategy constructionStrategy) {
        return constructionStrategyMapper.gonglvList(constructionStrategy);
    }

    @Override
    public Long gonglvListCount(ConstructionStrategy constructionStrategy) {
        return constructionStrategyMapper.gonglvListCount(constructionStrategy);
    }
}
